<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.liufeng.course.service.RequestService"%>
<%@ page import="net.sf.json.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="com.baidu.bae.api.factory.BaeFactory"%> 
<%@ page import="com.baidu.bae.api.memcache.BaeCache"%> 
<%
String cacheId ="DXOkKHgtLdSlbtYXMeNi";
	String memcacheAddr ="cache.duapp.com:20243";
	String user ="Ec2chH8MHnfQo9cUi0ga6jw9";
	String pwd ="tP94jTsaYQCj8XkRw8nb3QmmYAFp4OX0";
	String time ="";

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
try{
	  BaeCache baeCache = BaeFactory.getBaeCache(cacheId, memcacheAddr, user, pwd);
	  String json = baeCache.get("yqJson").toString();
	  time = baeCache.get("Time").toString();
	  JSONObject ob=JSONObject.fromObject(json);
	  JSONArray array=ob.getJSONArray("result");


%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta name="viewport"
	content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<html>
<head>
<base href="<%=basePath%>">

<title>奉化市重点河道水位、潮位站水位</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>

<style type="text/css">
.info {
	width: 100%;
	background: #c0c0c0;
}

.info td,.info th {
	padding: 4px;
	line-height: 40px;
	font-size: 16;
}

.info td {
	background: #fff;
	text-align: center;
}

.info td.aleft {
	text-align: left;
}

.info td.prohead {
	background: #eaf3ff
}

.info th {
	text-align: center;
	color: #333;
	font-weight: bold;
	verticle-align: middle;
	background: #eee;
	white-space: nowrap;
}

.info tr.overcolor td {
	background: #fcfbcc
}

.info td.prohead {
	background: #6AB4FF
}

.red font {
	color: red;
}

.info tr:hover td {
	background-color: #D1F1F1;
}
</style>
<script type="text/javascript">
	jQuery.ajaxSetup ({
	   		 cache:false
	    })
	    
	 function truan(stcd,STNM){
	 	window.location.href = "rainFallInfo.jsp?stcd="+stcd+"&STNM="+STNM;
	 }
	 
	 
	</script>
</head>

<body>
	<div id="menubox1">
		<p style="color:red">温馨提醒：</p>
		<p style="color:red">点击雨量站后进入24小时降雨过程曲线页面,可点击底部自定义查询时间段进行查询选择时间段内的降雨过程线；</p>
		<table class="info" id="info">
			<tr id="th">
				<th>雨量站名</th>
				<th>24h(mm)</th>
				<th>48h(mm)</th>
			</tr>
			<%for(int i=0;i<array.size();i++){
				  String isWarn = array.getJSONObject(i).get("isWarn").toString();
				  String stcd = array.getJSONObject(i).get("STCD").toString();
				  String STNM = array.getJSONObject(i).get("STNM").toString();
				  
			  %>
			<tr id='<%=stcd %>'
				<%if(isWarn.equals("true")){out.print("class='red'");} %>
				onclick="truan('<%=stcd %>','<%=STNM %>')">
				<td><font><%= array.getJSONObject(i).get("STNM")%> </font></td>
				<td><font><%=array.getJSONObject(i).get("H24_DRP")%></font></td>
				<td><font><%=array.getJSONObject(i).get("H48_DRP")%></font></td>
			</tr>
			<%} }catch(Exception e){ %>
			<img src="pic/error.jpg" style="width:100%">
			<%}
			%>
		</table>
		<p>更新时间：<%=time %></p>
		<p><a href="rainFall.jsp">latest</a></p>
	</div>
</body>
</html>
